(function(window){
	class Monster{
		monsterInfo={
			width:'50',
			height:'50',
			monsterImg:'url(./img/cxk.jpg)',
			location:{
				x:'',
				y:''
			}
			
		}
		monsterEl=null
		constructor(){
			
			//初始化怪物数据
			this.initMonster()
			//生成怪物
			this.generateMonsterEl()
			
		}
		//初始化怪物信息
		initMonster(){
			var x= Math.round(Math.random()*800);
			var y=Math.round(Math.random()*800);
			this.monsterInfo.location.x=x
			this.monsterInfo.location.y=y			
		}
		
		generateMonsterEl(){
				this.monsterEl=document.createElement("div")
				this.monsterEl.style.position='absolute'
				window.document.querySelector('body').append(this.monsterEl)//将怪物添加到页面
				this.monsterEl.style.width=this.monsterInfo.width+'px'
				this.monsterEl.style.height=this.monsterInfo.height+'px'
				this.monsterEl.style.left=this.monsterInfo.location.x+'px'
				this.monsterEl.style.top=this.monsterInfo.location.y+'px'
				this.monsterEl.style.backgroundImage =this.monsterInfo.monsterImg
				this.monsterEl.style.backgroundSize="50px 50px";
		}
		
		
		
		
		
		
	}
	
	
	window.Monster=Monster
	
	
	
	
	
})(window);